// 解决node jsx 报错问题
// https://babeljs.io/docs/en/babel-register
// https://babeljs.io/docs/en/babel-preset-react#via-node-api
require('@babel/register')({
  presets: ['@babel/preset-env', '@babel/preset-react']
})

const express = require('express')
const appRouter = require('./server/appRouter')
const apiRouter = require('./server/apiRouter')

const app = express()

// 后端接口api
app.use('/api/', apiRouter)

// 提供静态资源
app.use('/build', express.static('build'))

// 服务端渲染
app.use('/', appRouter)



app.listen(3000, () => {
  console.log('server is listen on port 3000');
})
